<script setup lang="ts">
import { ContentWrap } from '@/components/ContentWrap'
import { useI18n } from '@/hooks/web/useI18n'
import { Table } from '@/components/Table'
import {getTableList2Api} from '@/api/table'
import {keChengDianZanReDu} from '@/api/table/types'
import { ref } from 'vue'
import { TableColumn, TableSlotDefault } from '@/types/table'
import kcdzrdTjt from "./KeChengDianZanReDuTongJiTu.vue";

interface Params {
  pageIndex?: number
  pageSize?: number
}

const { t } = useI18n()
let tableDataList = ref<keChengDianZanReDu[]>([])

const getTableList = async () => {
  const res = await getTableList2Api()
      .catch(() => {})
      .finally(() => {
        loading.value = false
      })
  if (res) {
    tableDataList.value = res.data

  }
}

getTableList()
const columns: TableColumn[] = [

  {
    field: 'courseClassName',
    label: '课程类型'
  },
  {
    field: 'LookNum',
    label: "点赞次数"
  },
]

const loading = ref(true)


const actionFn = (data: TableSlotDefault) => {

}
</script>

<template>
  <ContentWrap :title="t('tongJi.title2')">
    <Table
        :columns="columns"
        :data="tableDataList"
        :loading="loading"
        :defaultSort="{ prop: 'display_time', order: 'descending' }"
    >
      <template #action="data">
        <ElButton type="primary" @click="actionFn(data as TableSlotDefault)">
          {{ t('tableDemo.action') }}
        </ElButton>
      </template>
    </Table>
  </ContentWrap>
  <kcdzrdTjt/>
</template>
